Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base.decompose(::BFloat16) #50

Merged
merged 3 commits into from
Nov 6, 2023
Merged

Conversation

milankl
Copy link
Member

@milankl milankl commented Jul 13, 2023

Following ideas of

https://github.com/JuliaLang/julia/blob/cdec4c21bdfffa9b198b8ecdde83aa082ebfc4e9/base/float.jl#L736-L756

So that

s,e,d = Base.decompose(x::BFloat16)
BFloat16(s*2^e/d) == x

@codecov
Copy link

codecov bot commented Jul 13, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a42c4fa) 65.41% compared to head (fe6ddca) 67.60%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #50      +/-   ##
==========================================
+ Coverage   65.41%   67.60%   +2.19%     
==========================================
  Files           3        3              
  Lines         133      142       +9     
==========================================
+ Hits           87       96       +9     
  Misses         46       46              
Files Coverage Δ
src/bfloat16.jl 74.21% <100.00%> (+1.94%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ViralBShah
Copy link
Member

@oscardssmith merge?

@oscardssmith
Copy link
Member

oscardssmith commented Oct 31, 2023

I thought our BFloat16 plan was to not do anything other than the LLVM intrinsics in Base, and let a package add all the methods, but I might be mistaken here.

EDIT I thought this was in the Julia repo

@ViralBShah
Copy link
Member

@milankl Let me know if you'd find it useful to have commit access to this package.

@milankl
Copy link
Member Author

milankl commented Oct 31, 2023

I thought our BFloat16 plan was to not do anything other than the LLVM intrinsics in Base, and let a package add all the methods, but I might be mistaken here.

Shouldn't the long-term plan be to have BFloat16 in Base as are Float16/32/64? But to be less intrusive for now and not do all the work at once, have this package where we/users of BFloat16 can add all missing methods they need for BFloat16? Hopefully we will then eventually reach a maturity here that we can think about moving some of the BFloat16 support into Base? I feel it just requires more general hardware support for more people to actively use BFloat16s.jl till then we can happily add methods here?

@milankl
Copy link
Member Author

milankl commented Oct 31, 2023

@milankl Let me know if you'd find it useful to have commit access to this package.

Yes, I'd be happy to add more methods here whenever I work with BFloat16!

@milankl milankl merged commit 9f3e1be into JuliaMath:master Nov 6, 2023
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants